package com.boy.service.impl;

import com.boy.service.WeatherService;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

/**
 * @author whd
 * @date 2024/08/16 14:51:28
 */
@Service
public class WeatherServiceImpl implements WeatherService {


    @Override
    public String getWeather(String cityCode) {

        RestTemplate restTemplate = new RestTemplate();
        ResponseEntity<String> response = restTemplate.getForEntity("http://t.weather.sojson.com/api/weather/city/"+cityCode, String.class);
        return response.getBody();
    }
}
